package com.xpsoft.oa.workflow.event;

import org.jbpm.api.jpdl.DecisionHandler;
import org.jbpm.api.model.OpenExecution;
import org.jbpm.api.model.OpenProcessInstance;

import com.xpsoft.core.util.ContextUtil;
import com.xpsoft.oa.model.system.AppUser;



//申请人权限判断
public class LeaveDecisionFirstHandler implements DecisionHandler {

	@Override
	public String decide(OpenExecution execution) {
		
		String result = "";
		int flag = 0;
		OpenProcessInstance pi = execution.getProcessInstance();
        AppUser flowStartUser=(AppUser)pi.getVariable("flowStartUser");
        flag = ContextUtil.getHighestRole(flowStartUser);

        switch(flag){
      		case 1: result="普通员工";break;//普通员工
      		case 2: result="非普通员工";break;//部门经理
      	}
		return result;
	}

}
